// inject page script
(function(){

// browser content page load (inject entry)
function pageLoad(evt){
	var doc = evt.originalTarget;
	function debug(msg){ try{ Firebug.Console.log("LoU Kracken: " + msg); }catch(ohwells){} }
	
	if (doc.nodeName == "#document" && doc.location.href.match(/http:\/\/prodgame.*\.lordofultima\.com\/.*\/index.aspx.*/i)){
		try {
			
			// assumes com_senocular_LoUDefiant_pageScript 
			// to be predefined in another script
			var script = doc.createElement("script");
			script.setAttribute("type", "text/javascript");
			script.setAttribute("title", "Kracken");
			script.innerHTML = "(" + com_senocular_LoUDefiant_pageScript.toString() + ")();";
			doc.getElementsByTagName("head")[0].appendChild(script);
			debug("injected");
		
		}catch(e){ debug(e); }
	}
}

// extension load (extension entry)
window.addEventListener("load", function () {
	gBrowser.addEventListener("load", pageLoad, true);
}, false);

})();
